package com.hitsf.controller;


import com.hitsf.bean.Department;
import com.hitsf.mapper.DepartmentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
public class DepartmentController {
    @Autowired
    DepartmentMapper departMapper;

    @RequestMapping("/dept/{id}")
    public Department getDepartment(@PathVariable("id") Integer id){
        return departMapper.getById(id);
    }

    @RequestMapping("/dept/getDepartmentById")
    public Department getDepartmentById(@RequestParam(value = "id") Integer id){
        return departMapper.getById(id);
    }

    @GetMapping("/dept/add")
    public Department insertDept(Department department){
        departMapper.insertDept(department);
        return department;
    }

}
